#include "Personnage.h"


void perInit(Personnage * pPer)
{
    pPer->posX=2;
    pPer->posY=1;
}

void perLibere(Personnage * pPer)
{
    pPer->posX=0;
    pPer->posY=0;
}

void persMonter(Personnage * pPer,Terrain * pTer)
{
    if(verifProchCase(pTer, pPer->posX, pPer->posY-1))
        pPer->posY--;
}

void persDescendre(Personnage * pPer,Terrain * pTer)
{
    if(verifProchCase(pTer, pPer->posX, pPer->posY+0.05))
        pPer->posY=pPer->posY+0.05;
}

void persRecule(Personnage * pPer,Terrain * pTer)
{
    if(verifProchCase(pTer, pPer->posX-1, pPer->posY))
        pPer->posX--;
}

void persAvance(Personnage * pPer,Terrain * pTer)
{
    if(verifProchCase(pTer, pPer->posX+0.1, pPer->posY))
        pPer->posX+=0.2;
}


float persGetX(const Personnage * pPer)
{
    return pPer->posX;
}

float persGetY(const Personnage * pPer)
{
    return pPer->posY;
}
